﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ProjectMigrator;

namespace Tests
{
    [TestClass]
    public class CrmDataTypesTest
    {

        [TestMethod]
        public void TestCrmTypesCreateCrmNumber()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var account.creditlimit = CrmTypes.CreateCrmNumber(100);");
            var expected = "var account.creditlimit = 100;";

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestCrmTypesCreateCustomer()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var customer = CrmTypes.CreateCustomer(EntityName.contact, contact.contactid);");
            var expected = "var customer = new EntityReference(EntityName.contact, contact.contactid);";

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestCrmTypesNewCrmNumber()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var number = new CrmNumber(10);");
            var expected = "var number = 10;";

            Assert.AreEqual(expected, actual);
        }


        [TestMethod]
        public void TestCrmTypesNewCrmBoolean()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var booleanValue = new CrmBoolean(10);");
            var expected = "var booleanValue = 10;";

            Assert.AreEqual(expected, actual);
        }


        [TestMethod]
        public void TestCrmTypesNewCrmDecimal()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var number = new CrmDecimal(10);");
            var expected = "var number = 10;";

            Assert.AreEqual(expected, actual);
        }


        [TestMethod]
        public void TestCrmTypesNewCrmDouble()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var number = new CrmDouble(10);");
            var expected = "var number = 10;";

            Assert.AreEqual(expected, actual);
        }


        [TestMethod]
        public void TestCrmTypesNewCrmFloat()
        {
            var codeConversion = new CodeConversion();

            var actual = codeConversion.Convert("var number = new CrmFloat(10);");
            var expected = "var number = 10;";

            Assert.AreEqual(expected, actual);
        }
    }
}
